<?php 
class Controller 
{
    protected $controller;
    protected $action;
    protected $db;
    protected $view;
    public function __construct($controller,$action)
    {
       $this->db=new PdoMySQL();

       $this->controller=$controller;
       $this->action=$action;
       $this->view=new View($controller, $action);
    }

    public function assign($name,$value)
    {
        $this->view->assign($name,$value);
    }


    public function render($append=true)
    {
        $this->view->render($append);
    }

    //获取配置项
    public function getCfg($key="")
    {
        $sql="select * from liaoliao_setting where id=1";
        $setting=$this->db->getRow($sql);
        if (empty($key)) {
            return $setting;
        }else{
            return $setting[$key];
        }
    }
}